<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册</title>
<%@ include file="/WEB-INF/views/layout/public_css.jsp"%>
<%@ include file="/WEB-INF/views/layout/public_js.jsp"%>
<style type="text/css">
.display-none {
	display:none;
}
</style>

</head>
<body>
<%@ include file="/WEB-INF/views/layout/head.jsp"%>

<div class="container-fluid">
    <div class="row">
    	<div class="col-md-3"></div>
    	<div class="col-md-6">
    		
    		<form class="form-horizontal" id="register" action="<%=basePath%>/user/addUserStep1" method="post">
    		  <div  id="first-step">
	    		  <div class="form-group">
				    <label for="" class="col-sm-2 control-label">机构名</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="institutionName" name="institutionName" placeholder="">
				    </div>
				  </div>
	              <div class="form-group">
				    <label for="" class="col-sm-2 control-label">用户类型</label>
				    <div class="col-sm-10">
				      <select class="form-control" name="role" id="role">
						  <option value="1">产品/服务提供商</option>
						  <option value="2">社区服务提供商</option>
						  <option value="3">政府机构</option>
						  <option value="4">服务平台工作账号</option>
						  <option value="5">服务平台管理账号</option>
						</select>
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="" class="col-sm-2 control-label">用户名</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="username" name="username" placeholder="">
				    </div>
				  </div>
	              <div class="form-group">
				    <label for="" class="col-sm-2 control-label">密码</label>
				    <div class="col-sm-10">
				      <input type="password" class="form-control" id="password" name="password" placeholder="">
				    </div>
				  </div>
	              <div class="form-group">
				    <label for="" class="col-sm-2 control-label">确认密码</label>
				    <div class="col-sm-10">
				      <input type="password" class="form-control" id="institutionPicPath" name="institutionPicPath" placeholder="">
				    </div>
				  </div>
	              <div class="form-group">
				    <label for="" class="col-sm-2 control-label">联系人</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="contactMan" name="contactMan" placeholder="">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="" class="col-sm-2 control-label">联系方式</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="contactPhone" name="contactPhone" placeholder="">
				    </div>
				  </div>
				  <div class="form-group">
				    <label for="" class="col-sm-2 control-label">邮箱</label>
				    <div class="col-sm-10">
				      <input type="text" class="form-control" id="email" name="email" placeholder="">
				    </div>
				  </div>
				 
				  <p class="text-right"><button type="button" class="btn btn-default " id="button-s1">放弃</button> <button type="button" class="btn btn-default " id="button-1">下一步</button></p>
			  </div>
			 
		     
			</form>
    	</div>
    	
    </div> 
</div>
<script type="text/javascript" src="<%=basePath%>/public/jquery/jquery.js"></script>
<script type="text/javascript">
	$(function(){
		$("#button-1").click(function(){
			
			var name1 = $("#institutionName").val();
			var name2 = $("#username").val();
			$.ajax({
                url:"<%=basePath%>/user/validate?institutionName="+name1+"&username="+name2,
                type:"post",
                success:function(data)
                {
                	if(data == 1){
    					alert("您的机构名称或用户名重复");
    					return;
    			    }else{
    			    	$.ajax({
    		                url:"<%=basePath%>/user/addUserStep1",
    		                type:"post",
    		                data:$("#register").serialize(),
    		                success:function(data)
    		                {
    		                	window.location.href = "<%=basePath%>/civil/register2";
    		                }
    			    	});
    			    }
                }
                
            });   
		});
	});
</script>
</body>
</html>